package com.ruoyi.personnel.salary.monthly.service;

import com.ruoyi.personnel.salary.monthly.domain.MonthlyCond;
import com.ruoyi.personnel.salary.monthly.domain.MonthlyDomain;
import com.ruoyi.personnel.salary.monthly.domain.MonthlyDto;
import com.ruoyi.personnel.salary.monthly.mapper.MonthlyMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务处理层
 */
@Service
public class MonthlyServiceImpl implements IMonthlyService{
    @Autowired
    private MonthlyMapper monthlyMapper;

    /**
     * 根据搜索条件所有月薪
     * @param cond
     * @return
     */
    @Override
    public List<MonthlyDto> selectMonthlyList(MonthlyCond cond) {
        return monthlyMapper.selectMonthlyList(cond);
    }

    /**
     * 根据员工编号搜索具体的月薪记录
     * @param staffId
     * @return
     */
    @Override
    public MonthlyDto selectMonthlyById(String staffId) {
        return monthlyMapper.selectMonthlyById(staffId);
    }

    /**
     * 新增月薪
     * @param monthly
     * @return
     */
    @Override
    public int insertMonthly(MonthlyDomain monthly) {
        return monthlyMapper.insertMonthly(monthly);
    }

    /**
     * 更新月薪
     * @param monthly
     * @return
     */
    @Override
    public int updateMonthly(MonthlyDomain monthly) {
        return monthlyMapper.updateMonthly(monthly);
    }

    /**
     * 删除员工月薪
     * 仅修改员工删除标志
     * @param monthly
     * @return
     */
    @Override
    public int updateMonthlyDeleteFlag(MonthlyDomain monthly) {
        return monthlyMapper.updateMonthlyDeleteFlag(monthly);
    }

    /**
     * 读取月薪方法
     * @param staffId
     * @return
     */
//    @Override
//    public Double readMonthlySalary(String staffId) {
//        return monthlyMapper.readMonthlySalary(staffId);
//    }
}
